package cn.smbms.service.role;

import java.sql.Connection;
import java.util.List;

import cn.smbms.mapper.role.RoleMapper;
import cn.smbms.pojo.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("roleService")
public class RoleServiceImpl implements RoleService{
	
	@Autowired
	public RoleMapper roleMapper;
	
	@Override
	public List<Role> getAllRoleList() {
		return roleMapper.getAllRoleList();
	}

	@Override
	public boolean getRoleByCode(String code) {
		boolean flag = false;
		if(roleMapper.getRoleByCode(code)==0){
			flag = true;
		}
		return flag;
	}

	@Override
	public boolean del(String id) {
		boolean flag = false;
		if(roleMapper.del(id)>0){
			flag = true;
		}
		return flag;
	}

	@Override
	public boolean add(Role role) {
		boolean flag = false;
		if(roleMapper.add(role)>0){
			flag = true;
		}
		return flag;
	}

	@Override
	public boolean update(Role role, String id) {
		boolean flag = false;
		if(roleMapper.update(role,id)>0){
			flag = true;
		}
		return flag;
	}

	@Override
	public boolean getUserById(String id) {
		boolean flag = false;
		if(roleMapper.getUserById(id)==0){
			flag = true;
		}
		return flag;
	}

	@Override
	public Role getRoleById(String id) {
		return roleMapper.getRoleById(id);
	}

}
